﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QuartzNetJob
{
    public interface IQuartzHelper
    {
        /// <summary>
        ///   添加循环定时任务
        /// </summary>
        /// <typeparam name="T">被执行的类</typeparam>
        /// <param name="Seconds">毫秒</param>
        /// <returns></returns>
        public string SetIntervalJob<T>(int Seconds) where T : ScheduledTaskBase;
        /// <summary>
        ///   添加循环定时任务
        /// </summary>
        /// <typeparam name="T">被执行的类</typeparam>
        /// <param name="Seconds">毫秒</param>
        /// <returns></returns>
        public string SetIntervalJob<T>(int Minutes, object data, string JobKey) where T : ScheduledTaskBase;
        /// <summary>
        /// 每天定时执行
        /// </summary>
        /// <typeparam name="T">任务类</typeparam>
        /// <param name="h">小时</param>
        /// <param name="m">分钟</param>
        /// <param name="s">秒</param>
        /// <returns>jobKey</returns>
        public string SetDailyJob<T>(int h, int m, int s) where T : ScheduledTaskBase;
        /// <summary>
        /// 延迟执行
        /// </summary>
        /// <typeparam name="T">方法类</typeparam>
        /// <param name="delay">延迟时间</param>
        /// <param name="isFirst">运行时是否执行</param>
        /// <returns></returns>
        public string SetDelayJob<T>(DateTimeOffset delay, bool isFirst) where T : ScheduledTaskBase;
        /// <summary>
        /// 延迟执行（带参）
        /// </summary>
        /// <typeparam name="T">方法类</typeparam>
        /// <param name="delay">延迟时间</param>
        /// <param name="isFirst">运行时是否执行</param>
        /// <returns></returns>
        public void SetDelayJob<T>(DateTimeOffset delay, bool isFirst, object data,string JobWork) where T : ScheduledTaskBase;
        /// <summary>
        ///  删除任务
        /// </summary>
        /// <param name="JobKey"></param>
        public bool RemoveJob(string JobKey);
        /// <summary>
        ///  暂停所有Job
        /// </summary>
        /// <returns></returns>
        public bool PauseAllJobs();
        /// <summary>
        /// 恢复所有任务
        /// </summary>
        /// <returns></returns>
        public bool ResumeAllJobs();
        /// <summary>
        /// 恢复任务
        /// </summary>
        /// <param name="jobId"></param>
        public void ResumeJob(string jobId);
        /// <summary>
        ///  关闭所有任务,清理资源再也无法开始
        /// </summary>
        /// <returns></returns>
        public bool ShutDownAllJobs();
        /// <summary>
        ///  启动所有Job
        /// </summary>
        /// <returns></returns>
        public bool StartAllJob();
        /// <summary>
        ///  暂停单个Job
        /// </summary>
        /// <param name="JobKey">任务Id</param>
        public bool StopJob(string JobKey);
    }
}
